<%--
  Created by IntelliJ IDEA.
  User: 李毅
  Date: 2023/8/4
  Time: 9:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="path" value="${pageContext.request.contextPath }"/>
<html>
<head>
    <title>后端电影列表</title>
    <script src="${path}/js/jquery-3.6.4.js"></script>
<%--    <link href="${path}/css/lyCss/inquireMovie.css" rel="stylesheet" type="text/css">--%>
    <style>
        *{
            margin: 0px;
            padding: 0px;
        }
        .b1{
            width: 70px;
            height: 30px;
            text-align: center;
            line-height: 30px;
            display: inline-block;
            margin-left: 10px;
            background-color: #00cc9c;
            color: white;
            border-radius: 3px 3px 3px 3px;
            font-size: 12px;
            position: relative;
            left: 38px;
        }
        a{
            text-decoration: none;
        }
        .b2{
            background-color: white;
            position: relative;
            bottom: 21px;
            border-radius: 5px 5px 5px 5px;
        }
        img{
            width: 40px;
            height: 60px;
            display: inline-block;
        }
        table{
            border: 0px gainsboro;
            border-collapse: collapse;
            margin: 0px auto;
        }
        .a1{
            width: 60px;
            height: 80px;
            text-align: center;
        }
        .a2{
            width: 100px;
            text-align: center;
            color: #00cc9c;
        }
        .a3{
            width: 150px;
            text-align: center;
        }
        .a4{
            text-align: center;
            width: 80px;
        }
        .a5{
            text-align: center;
            width: 110px;
        }
        .a6{
            width: 230px;
            text-align: center;
        }
        .a7{
            width: 60px;
            text-align: center;
        }
        .a8{
            width: 100px;
            text-align: center;
            color: #00e689;
        }
        .a9{
            text-align: center;
            color: #00e689;
        }
        .a10{
            width: 80px;
            text-align: center;
        }
        td{
            font-size: 12px;
        }
        .b3{
            width: 100px;
            height: 30px;
            border: 1px solid gainsboro;
            text-align: center;
            line-height: 30px;
            background-color: aliceblue;
            margin-left: 850px;
        }
        .b4{
            width: 40px;
            height: 30px;
            font-size: 12px;
            background-color: #00cc9c;
            color: white;
            text-align: center;
            line-height: 30px;
            display: inline-block;
            margin-bottom: -11px;
            margin-left: 950px;
            position: relative;
            bottom: 30px;
        }
        .action .t{ height:41px; background:url(${path}/images/backIndex/right_bg.gif) no-repeat; font:14px 宋体; padding:10px 0 0 30px;}
        form{
            display: inline-block;
        }
        .n1{
            width: 50px;
            height: 20px;
            border-radius: 3px;
            border: 0px;
            background-color: #00cc9c;
            color: white;
            font-size: 12px;
        }
        .n2{
            width: 30px;
            height: 30px;
        }*{
             margin: 0px;
             padding: 0px;
         }
        .b1{
            width: 70px;
            height: 30px;
            text-align: center;
            line-height: 30px;
            display: inline-block;
            margin-left: 10px;
            background-color: #00cc9c;
            color: white;
            border-radius: 3px 3px 3px 3px;
            font-size: 12px;
            position: relative;
            top: 30px;
        }
        .b2{
            background-color: white;
            position: relative;
            bottom: 21px;
            border-radius: 5px 5px 5px 5px;
        }
        img{
            width: 40px;
            height: 60px;
            display: inline-block;
        }
        table{
            border: 0px gainsboro;
            border-collapse: collapse;
            margin: 0px auto;
        }
        .a1{
            width: 60px;
            height: 80px;
            text-align: center;
        }
        .a2{
            width: 100px;
            text-align: center;
            color: #00cc9c;
        }
        .a3{
            width: 150px;
            text-align: center;
        }
        .a4{
            text-align: center;
            width: 80px;
        }
        .a5{
            text-align: center;
            width: 110px;
        }
        .a6{
            width: 230px;
            text-align: center;
        }
        .a7{
            width: 60px;
            text-align: center;
        }
        .a8{
            width: 100px;
            text-align: center;
            color: #00e689;
        }
        .a9{
            text-align: center;
            color: #00e689;
        }
        .a10{
            width: 80px;
            text-align: center;
        }
        td{
            font-size: 12px;
        }
        .b3{
            width: 140px;
            height: 30px;
            border: 1px solid gainsboro;
            text-align: center;
            line-height: 30px;
            background-color: aliceblue;
            margin-left: 850px;
        }
        .b4{
            width: 50px;
            height: 30px;
            font-size: 12px;
            background-color: #00cc9c;
            color: white;
            text-align: center;
            line-height: 30px;
            display: inline-block;
            margin-bottom: -11px;
            margin-left: 950px;
            position: relative;
            bottom: 30px;
            left: 40px;
        }
        .action .t{
            height:41px;
            background:url(${path}/images/backIndex/right_bg.gif) no-repeat;
            font:14px 宋体;
            padding:10px 0 0 30px;
        }
        form{
            display: inline-block;
        }
        .n1{
            width: 70px;
            height: 30px;
            text-align: center;
            line-height: 30px;
            background-color: #00cc9c;
            color: white;
            border-radius: 3px 3px 3px 3px;
            font-size: 12px;
            display: inline-block;
            border: 0px;
        }
        .n2{
            width: 30px;
            height: 30px;
        }
    </style>
</head>
<body>
<div class="action  divaction">
    <div class="t">
        电影列表
    </div>
    <div class="b2">
        <div ><a href="${path}/jsp/addMovie.jsp" class="b1">添加</a></div>
        <form method="post" action="${path}/MovieServlet?prom=showAll">
            <c:set var="movie_name" value="${sessionScope.movie_name}"/>
            <div>
                <input type="text" class="b3" placeholder="请输入电影名称"  name="movie_cn_name" value="${sessionScope.movie_name}">
                <input type="submit" value="搜索" class="b4" style="border: 0px ">
            </div>
        </form>
       <%-- <table border="1">
            <tr>
                <th>剧照</th>
                <th>电影名</th>
                <th>类型</th>
                <th>地区</th>
                <th>导演</th>
                <th>演员</th>
                <th>片长</th>
                <th>上映时间</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            <c:set var="movieList" value="${sessionScope.movieList}"/>
            <c:choose>
                <c:when test="${empty movieList}">
                    <script>
                        window.location="${path}/MovieServlet?prom=showAll";
                    </script>
                </c:when>
                <c:otherwise>
                    <c:forEach var="ml" items="${movieList}">
                        <tr id="${ml.movie_id}">
                            <td class="a1"><img src="${path}/images/moviePicture/${ml.movie_picture}"></td>
                            <td class="a2">${ml.movie_cn_name}</td>
                            <td class="a3">${ml.movie_type}</td>
                            <td class="a4">${ml.movie_country}</td>
                            <td class="a5">${ml.movie_director}</td>
                            <td class="a6">${ml.movie_actor}</td>
                            <td class="a7">${ml.movie_duration}</td>
                            <td class="a8">${ml.movie_releaseDate}</td>
                            <td class="a9">
                                <c:if test="${ml.movie_state==1}">
                                    在线
                                </c:if>
                                <c:if test="${ml.movie_state==2}">
                                    预售
                                </c:if>
                                <c:if test="${ml.movie_state==3}">
                                    下架
                                </c:if>
                            </td>
                            <td class="a10">
                                <img src="${path}/images/tool/xiugai.jpg" class="n2" onclick="updMovie(${ml.movie_id})">
                                <img src="${path}/images/tool/shanchu.jpg" class="n2" onclick="delMovie(${ml.movie_id})">
                            </td>
                        </tr>
                    </c:forEach>
                </c:otherwise>
            </c:choose>
            <tr style="height: 50px;">
                <th colspan="10" align="center">
                    <p style="display: inline-block">当前页数：[${sessionScope.pages.currPageNo}/${sessionScope.pages.totalPageCount}]
                        <c:if test="${sessionScope.pages.currPageNo>1}">
                    <form method="post" action="${path}/MovieServlet?prom=showAll&pageIndex=1">
                       <input type="submit" value="首页" class="n1">
                    </form>
                    <form method="post" action="${path}/MovieServlet?prom=showAll&pageIndex=${sessionScope.pages.currPageNo-1}&movie_name=${sessionScope.movie_name}">
                        <input type="submit" value="上一页" class="n1" >
                    </form>
                        </c:if>
                        <c:if test="${sessionScope.pages.currPageNo<sessionScope.pages.totalPageCount}">
                            <form method="post" action="${path}/MovieServlet?prom=showAll&pageIndex=${sessionScope.pages.currPageNo+1}&movie_name=${sessionScope.movie_name}">
                                <input type="submit" value="下一页" class="n1">
                            </form>
                            <form method="post" action="${path}/MovieServlet?prom=showAll&pageIndex=${sessionScope.pages.totalPageCount}&movie_name =${sessionScope.movie_name}">
                                <input type="submit" value="末页" class="n1">
                            </form>
                        </c:if>
                    </p>
                </th>
            </tr>
        </table>--%>
    </div>
</div>
<script type="text/javascript">
   /* function delMovie(id){
        var str=confirm("确认删除吗？");
        if (str){
            $.post("${path}/MovieServlet?prom=delMovie","&id="+id,function (result) {
                if(result>0){
                    alert("删除成功");
                    $("#"+id).remove(); //移除当前删除的行
                }else {
                    alert("删除失败");
                }
            });
        }
    }*/
    function updMovie(movieId){
        window.location="${path}/UpdateMovieServlet?prom=selMovie&movie_id="+movieId;
    }
</script>
</body>
</html>
